import { request } from '@/utils/request'
import qs from 'query-string'

/**
 * @params photo 头像文件 file 必须通过 new FormData() 来进行装载传递 => 直接打印 FormData 数据是无法看到内容不内容的
 */
export const addCover = (data) =>
  request({
    method: 'POST',
    url: '/dynamic/add/cover',
    data,
    contentType: false,
    processData: false
  })
export const addNewMic = (data) =>
  request({
    method: 'POST',
    url: '/dynamic/add',
    data: qs.stringify(data)
  })

export const getMic = (data) =>
  request({
    method: 'POST',
    url: '/dynamic/getMic',
    data: qs.stringify(data)
  })
export const postUserMic = (data) =>
  request({
    method: 'POST',
    url: '/dynamic/postUserMic',
    data: qs.stringify(data)
  })

export const postUserLikedMic = (data) =>
  request({
    method: 'POST',
    url: '/dynamic/postUserLikedMic',
    data: qs.stringify(data)
  })
export const deleteMic = (target) =>
  request({
    method: 'DELETE',
    url: `/dynamic/deleteMic/${target}`
  })
